package com.tea.Model.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class GoodsSpecVO {
    //规格id
    private Long id;
    //规格说明
    private String specRemark;
    //价格
    private BigDecimal price;
    //商品id
    private Long goodsId;
    //库存数量
    private Long stockNum;
    //库存状态：available-有库存，soldout-已售罄
    private String stockStatus;
    
    /**
     * 根据库存数量设置库存状态
     */
    public void setStockStatus() {
        if (this.stockNum != null && this.stockNum > 0) {
            this.stockStatus = "available";
        } else {
            this.stockStatus = "soldout";
        }
    }
}